﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Runtime.Serialization;
using System.Security.Permissions;

namespace RecommendatioNetwork
{
    [Serializable]
    public class Ranking:IComparable
    {
        private Configuration conf;
        public Ranking(Configuration conf) {
            this.conf = conf;
        }
        public int Request { set ; get ;}
        public int RequestFailed { set; get; }
        public int Response { set; get; }
        
        public int RequestGaranteed{ 
            get { return (Request-RequestFailed); }
        }

        public float Rank {
            get { return (float)(((float)RequestGaranteed / (float)Request) * ((float)(100 - conf.WeightConnectedVSResponder)) + ((float)Response / (float)Request) * ((float)conf.WeightConnectedVSResponder)); }
        }

        public int CompareTo(object obj)
        {
            Ranking other = (Ranking)obj;
            if (other.Rank > this.Rank)
                return -1;
            else if (other.Rank == this.Rank)
                return 0;
            else
                return 1;
            
        }
    }
}

